<template>
    <div>
        <el-menu :default-active="activeIndex" class="el-menu-demo"  mode="vertical" :router="true"  v-if="roleId == 'TEACHER' || roleId =='UNIVERSITY_TEACHER'">
            <el-menu-item index="/Setting/Notice/Myinfomation">基本信息</el-menu-item>
            <el-menu-item index="/Setting/Notice/ChangeCode">修改密码</el-menu-item>
            <!-- <el-menu-item index="/Setting/Notice/TNotification">消息通知</el-menu-item>
            <el-menu-item index="/Setting/Notice/STProblemBack">问题反馈</el-menu-item> -->
            <el-menu-item index="/Setting/Notice/systemVersion">系统版本</el-menu-item>
        </el-menu>
        <el-menu :default-active="activeIndex" class="el-menu-demo"  mode="vertical" :router="true"  v-if="roleId == 'MARKET_TEACHER'">
            <el-menu-item index="/Setting/Notice/Myinfomation">基本信息</el-menu-item>
            <el-menu-item index="/Setting/Notice/ChangeCode">修改密码</el-menu-item>
            <!-- <el-menu-item index="/Setting/Notice/Application" >申请账号</el-menu-item> -->
            <el-menu-item index="/Setting/Notice/TNotification">消息通知</el-menu-item>
            <el-menu-item index="/Setting/Notice/STProblemBack">问题反馈</el-menu-item>
            <el-menu-item index="/Setting/Notice/systemVersion">系统版本</el-menu-item>
        </el-menu>
         <el-menu :default-active="activeIndex" class="el-menu-demo"  mode="vertical" :router="true"  v-if="roleId == 'STUDENT'">
            <el-menu-item index="/Setting/Notice/Myinfomation">基本信息</el-menu-item>
            <el-menu-item index="/Setting/Notice/ChangeCode">修改密码</el-menu-item>
            <!-- <el-menu-item index="/Setting/Notice/STNotification">消息通知</el-menu-item>
            <el-menu-item index="/Setting/Notice/STProblemBack">问题反馈</el-menu-item> -->
            <el-menu-item index="/Setting/Notice/systemVersion">系统版本</el-menu-item>
        </el-menu>
        <el-menu :default-active="activeIndex" class="el-menu-demo"  mode="vertical" :router="true"  v-if="roleId == 'ADMIN'">
            <el-menu-item index="/Setting/Notice/Myinfomation">基本信息</el-menu-item>
            <el-menu-item index="/Setting/Notice/ChangeCode">修改密码</el-menu-item>
        </el-menu>
         <el-menu :default-active="activeIndex" class="el-menu-demo"  mode="vertical" :router="true"  v-if="roleId =='SUPER_ADMIN'">
            <el-menu-item index="/Setting/Notice/Myinfomation">基本信息</el-menu-item>
            <el-menu-item index="/Setting/Notice/ChangeCode">修改密码</el-menu-item>
            <el-menu-item index="/Setting/Notice/AProblemBacks">问题反馈</el-menu-item>
        </el-menu>
           <el-menu :default-active="activeIndex" class="el-menu-demo"  mode="vertical" :router="true"  v-if=" roleId =='INTERNET_ADMIN'">
            <el-menu-item index="/Setting/Notice/Myinfomation">基本信息</el-menu-item>
            <el-menu-item index="/Setting/Notice/ChangeCode">修改密码</el-menu-item>
            <el-menu-item index="/Setting/Notice/AProblemBacks">问题反馈</el-menu-item>
            <!-- <el-menu-item index="/Setting/Notice/AdminApplication">申请账号</el-menu-item> -->
        </el-menu>
    </div>
</template>

<script>
    export default {
        data () {
            return {
                activeIndex: '',
                roleId:''
            }
        },
        created () {
            let self = this
            self.fetchDate()
            this.roleId=this.$store.state.user.roles[0]
           // this.roleId=this.getCookie('Admin-Token')
        },
        methods: {
            fetchDate() {
                let self = this
                var cur_path = self.$route.meta.navActive; //获取当前路由
                self.activeIndex = cur_path
            },
    //         //获取cookie
    //          getCookie (cname) {
    //             var name = cname + "=";
    //             var ca = document.cookie.split(';');
    //             for (var i = 0; i < ca.length; i++) {
    //               var c = ca[i];
    //               while (c.charAt(0) == ' ') c = c.substring(1);
    //               if (c.indexOf(name) != -1){
    //                 return c.substring(name.length, c.length);
    //               }
    //             }
    //             return "";
    //          },
        },
        watch: {
            "$route": "fetchDate"
		}
    }
</script>
<style>
    .el-menu{
        border-right: none
    }
    .el-menu-item:focus, .el-menu-item:hover{
        color: #409EFF;
    }
</style>

